/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core;

/**
 *
 * @author MOI
 */
public abstract class CoreThread extends Thread {
    private boolean run=false;
    private boolean work = false;

    @Override
    public void run() {
        run=true;
        work=true;
        while(run)
        {
            if(work)
                action();
            else
                yield();
        }
    }

    abstract protected void action();
    public void arreter()
    {
        this.run=false;
    }
    public void pause()
    {
        work=false;
    }
    public void reprise()
    {
        work=true;
    }

}
